home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / perl5 / RPC / XML / listMethods.xpl < prev    next >
Encoding:
Extensible Markup Language  |  2008-11-04  |  1.7 KB  |  60 lines

  1. <?xml version="1.0" encoding="iso-8859-1"?>
  2. <!DOCTYPE methoddef SYSTEM "rpc-method.dtd">
  3. <!--
  4.     Generated automatically by make_method v1.12, Wed Nov  5 03:59:22 2008
  5.  
  6.     Any changes made here will be lost.
  7. -->
  8. <methoddef>
  9. <name>system.listMethods</name>
  10. <version>1.1</version>
  11. <signature>array</signature>
  12. <signature>array string</signature>
  13. <help>
  14. List all the methods known to the server. If the STRING parameter is passed,
  15. it is used as a substring to match against, with only those matching methods
  16. being returned. Note that the STRING parameter is not a regular expression,
  17. but rather just a simple substring.
  18. </help>
  19. <code language="perl">
  20. <![CDATA[
  21. #!/usr/bin/perl
  22. ###############################################################################
  23. #
  24. #   Sub Name:       listMethods
  25. #
  26. #   Description:    Read the current list of methods from the server object
  27. #                   and return the names in a list reference.
  28. #
  29. #   Arguments:      NAME      IN/OUT  TYPE      DESCRIPTION
  30. #                   $srv      in      ref       Server object instance
  31. #                   $pat      in      scalar    If passed, a substring to match
  32. #                                                 names against. NOT a regex!
  33. #
  34. #   Globals:        None.
  35. #
  36. #   Environment:    None.
  37. #
  38. #   Returns:        listref
  39. #
  40. ###############################################################################
  41. sub listMethods
  42. {
  43.     use strict;
  44.  
  45.     my $srv = shift;
  46.     my $pat = shift;
  47.  
  48.     my @list = sort $srv->list_methods;
  49.  
  50.     # Exclude any that are hidden from introspection APIs
  51.     @list = grep(! $srv->get_method($_)->hidden, @list);
  52.     @list = grep(index($_, $pat) != -1, @list) if ($pat);
  53.  
  54.     \@list;
  55. }
  56.  
  57. __END__
  58. ]]></code>
  59. </methoddef>
  60.